﻿using System;

namespace IkeCode.WP7.Toolkit.Persist
{
    /// <summary>
    /// Custom attribute to make properties with image cacheable
    /// </summary>
    [AttributeUsage(AttributeTargets.Property, Inherited=true)]
    public class CacheImage : Attribute
    {
        /// <summary>
        /// Encode image to PNG if necessary.
        /// </summary>
        public bool EncodeToPNG { get; private set; }

        /// <summary>
        /// Default constructor, cache image without png encoding
        /// </summary>
        /// <param name="encodeToPNG">
        /// Encode image to PNG if necessary.
        /// <para>
        /// *(Windows Phone don't support gifs for example)
        /// </para>
        /// </param>
        public CacheImage(bool encodeToPNG = true)
        {
            this.EncodeToPNG = encodeToPNG;
        }
    }
}
